<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>学生主页</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/layuiadmin/style/template.css" media="all">
</head>
<body>
<div class="layui-header">
    <!-- 头部区域 -->
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">学号：${stu.studentNo}</label>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">姓名：${stu.name}</label>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">性别：${stu.gender}</label>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 150px;">手机号：${stu.moblephone}</label>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 150px;">邮箱：${stu.eMail}</label>
                    </div>
                    <div class="layui-inline" style="float:right">
                        <button class="layui-btn layui-btn-primary">
                            <a href="${basePath}/stu/redirect">退出登录</a>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-card-body">
        <div class="layui-fluid layadmin-maillist-fluid">
            <div style="width:100%; margin: 0;">
                <button type="button" class="layui-btn layui-btn-fluid">作业列表</button>
            </div>
            <div class="layui-row layui-col-space15">
                <c:forEach items="${zuoye}" var="zuoye">
                     <div class="layui-col-md4 layui-col-sm6">
                          <div class="layadmin-contact-box" >
                               <div class="layui-col-md12 layadmin-padding-left20 layui-col-sm6">
                                   <a href="javascript:;"><h3 ><strong>${zuoye.name}</strong> </h3></a>
                                    <div class="layadmin-address">
                                        <a href="javascript:;">
                                            <hr>
                                            <strong>
                                                课程名称：${zuoye.remark2}
                                                <br>
                                                <hr>
                                                开始时间：${zuoye.startTime}
                                            <br>
                                                <hr>
                                            结束时间：${zuoye.endTime}
                                            <br>
                                                <hr>
                                            提前时间：${zuoye.beforeTime}
                                            <br>
                                                <hr>
                                            提交状态：${zuoye.typeShow}
                                           </strong>
                                            <br>
                                            <button class="layui-btn layui-btn-primary" style="float:right" onclick="jinru(${zuoye.id})">进入</button>
                                        </a>
                                    </div>
                               </div>
                          </div>
                     </div>
                </c:forEach>
                <c:if test="${empty zuoye}"><div style="text-align:center">
                    <br>
                    <strong>无作业数据</strong>
                </div></c:if>
            </div>
        </div>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-card-body">
        <div class="layui-fluid layadmin-maillist-fluid">
            <div style="width:100%; margin: 0;">
                <button type="button" class="layui-btn layui-btn-fluid">考试列表</button>
            </div>
            <div class="layui-row layui-col-space15">
                <c:forEach items="${kaoshi}" var="zuoye">
                    <div class="layui-col-md4 layui-col-sm6">
                        <div class="layadmin-contact-box" >
                            <div class="layui-col-md8 layadmin-padding-left20 layui-col-sm6">
                                <a href="javascript:;"><h3 ><strong>${zuoye.name}</strong> </h3></a>
                                <div class="layadmin-address">
                                    <a href="javascript:;">
                                        <hr>
                                        <strong>
                                            课程名称：${zuoye.remark2}
                                            <br>
                                            <hr>
                                            开始时间：${zuoye.startTime}
                                            <br>
                                            <hr>
                                            结束时间：${zuoye.endTime}
                                            <br>
                                            <hr>
                                            提前时间：${zuoye.beforeTime}
                                            <br>
                                            <hr>
                                            提交状态：${zuoye.typeShow}
                                        </strong>
                                        <br>
                                        <button class="layui-btn layui-btn-primary" style="float:right" onclick="jinru(${zuoye.id})">进入</button>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </c:forEach>
                <c:if test="${empty kaoshi}">
                    <div style="text-align:center">
                        <br>
                        <strong>无考试数据</strong>
                    </div>
                </c:if>
            </div>
        </div>
    </div>
</div>
<form id="subExam" action="/stu/selectExam" method="post">
     <input type="hidden" id="id" name="id">
</form>
<script src="<%=request.getContextPath()%>/static/login/js/jquery-2.1.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '<%=request.getContextPath()%>/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use('index');
    layui.use(['layer','form', 'table', 'element'], function(){
        var layer = layui.layer //弹层
            ,form = layui.form
            ,table = layui.table //表格
            ,$ = layui.$
    });

    function jinru(id){
        layer.open({
            type: 1 //Page层类型
            ,btn:["确定","取消"]
            ,title: '输入密码'
            ,skin: 'layui-layer-prompt'
            ,content: "<div class=''><input type='password' name='password' class='layui-layer-input'placeholder='输入密码'><br/></div>"
            ,yes: function(index, layero){
                //按钮【按钮一】的回调
                var password=$(layero).find("input[name='password']").val();
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/stu/verifyPassword",
                    data: {"id":id,"password":password},
                    dataType: "json",
                    success: function (data1) {
                        if (data1.code === 0) {
                            //window.location.href='<%=request.getContextPath()%>/stu/selectExam?id='+id //iframe的url
                            $('#id').val(id);
                            $('#subExam').submit();
                        } else {
                            layer.msg("密码错误")
                        }
                    }
                });
            }
        });
    }
</script>
</body>
</html>
